Skip to content

feat(rust): Add tags to AssumeRoleProviderBuilder#4330

Merged
ysaito1001 merged 12 commits intosmithy-lang:mainfrom
c-thiel:main
Oct 7, 2025
Merged

feat(rust): Add tags to AssumeRoleProviderBuilder#4330
ysaito1001 merged 12 commits intosmithy-lang:mainfrom
c-thiel:main

Conversation

@c-thiel
Copy link
Contributor

@c-thiel c-thiel commented Oct 3, 2025

Motivation and Context

See awslabs/aws-sdk-rust#1366

Description

See awslabs/aws-sdk-rust#1366

Checklist

  • For changes to the AWS SDK, generated SDK code, or SDK runtime crates, I have created a changelog entry Markdown file in the .changelog directory, specifying "aws-sdk-rust" in the applies_to key.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@c-thiel c-thiel requested review from a team as code owners October 3, 2025 15:18
@c-thiel
Copy link
Contributor Author

c-thiel commented Oct 3, 2025

Not really sure about the changelog. Please change it as desired.

@rcoh
Copy link
Collaborator

rcoh commented Oct 3, 2025

thanks!

@ysaito1001
Copy link
Contributor

ysaito1001 commented Oct 3, 2025

Just realized one thing. This CI check complains that the tag method now exposes a type that previously wasn't exposed. However, the method cannot take the Tag type from aws_sdk_sts directly either because aws-config should only depend on so-called runtime crates publicly (those listed in its allowed external-types) but not on generated SDK crates like aws-sdk-sts (ok to depend on them privately as implementation details).

One way to work around this is for the tag method to take plain Strings for key & value for tags, like

pub fn tags<K, V>(mut self, tags: impl IntoIterator<Item = (K, V)>) -> Self 
where
    K: Into<String>,
    V: Into<String>,
{...}

This is why a sibling method policy_arns takes a vec of plain Strings instead of a vec of PolicyDescriptorTypes.

Alternatively, we could define own tag type somewhere in the aws-config crate, and let the tags method take a vec of that tag type instead.

@ysaito1001 ysaito1001 self-requested a review October 3, 2025 21:35
@c-thiel
Copy link
Contributor Author

c-thiel commented Oct 5, 2025

Just realized one thing. This CI check complains that the tag method now exposes a type that previously wasn't exposed. However, the method cannot take the Tag type from aws_sdk_sts directly either because aws-config should only depend on so-called runtime crates publicly (those listed in its allowed external-types) but not on generated SDK crates like aws-sdk-sts (ok to depend on them privately as implementation details).

One way to work around this is for the tag method to take plain Strings for key & value for tags, like

pub fn tags<K, V>(mut self, tags: impl IntoIterator<Item = (K, V)>) -> Self 
where
    K: Into<String>,
    V: Into<String>,
{...}

This is why a sibling method policy_arns takes a vec of plain Strings instead of a vec of PolicyDescriptorTypes.

Alternatively, we could define own tag type somewhere in the aws-config crate, and let the tags method take a vec of that tag type instead.

@ysaito1001

I made the change, but we have a small problem here: Due to the absolutely awful builder of Tag, there is not typesafe constructor for this dead-simple type. The build method only fails if either key or value is None, which in our implementation cannot be the case. Hence I currently use unwrap, even though this is not nice.
The alternative would be to expose the Error type, this is however a type the sts crate again.

c-thiel and others added 2 commits October 6, 2025 17:23
@ysaito1001 ysaito1001 enabled auto-merge October 7, 2025 02:12
@ysaito1001 ysaito1001 merged commit 93ecc1f into smithy-lang:main Oct 7, 2025
45 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants